package com.example.project_springboot.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
//@Aspect
@Slf4j
public class Test1Aop {
    @Pointcut("execution(* com.example.project_springboot.aop.MyAop.*(..))")
    public void pt(){
    }
    @Before("pt()")
    public void before(JoinPoint joinPoint){
        log.info("before....");
    }
    @Around("pt()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        log.info("AROUND Before");
        Object proceed = point.proceed();
        log.info("around ...");
        return proceed;
    }
    @After("pt()")
    public void after() throws Throwable{
        log.info("after...");
    }
    @AfterReturning("pt()")
    public void afterReturning(){
        log.info("afterReturning....");
    }
    @AfterThrowing("pt()")
    public void afterThrowing(){
        log.info("afterThrowing...");
    }
}
